/*! \file VertexAccessor.h
 *	\brief <write description for VertexAccessor.h>
 *
 *	created:	2010/12/13
 *	created:	13:12:2010   15:33
 *	filename: 	C:\src\tactics-engine\libs\gd\VertexAccessor.h
 *	file path:	C:\src\tactics-engine\libs\gd
 *	file base:	VertexAccessor
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				vitalii.trubchaninov@ubisoft.com
 */

#ifndef _gd_VERTEXACCESSOR_H_
#define _gd_VERTEXACCESSOR_H_

#pragma once

#include <math/Vector3.h>

#include "BufferLocker.h"

namespace tt{
namespace gd{

class DeviceContext;
class VertexBuffer;
class VertexFormat;

class VertexAccessor
{
public:
	VertexAccessor(DeviceContext* , VertexBuffer&, VertexFormat&);
	~VertexAccessor();

	void setPosition(UInt index, const math::Vector3F&);
	void setNormal(UInt index, const math::Vector3F&);
	void setColor(UInt index, const math::Vector3F&);

private:
	math::Vector3F* vertexComponent(UInt index, UInt offset);

private:
	BufferLocker m_locker;
	UInt8* m_data;
	UInt m_vertexSize;
	UInt m_positionOffset;
	UInt m_normalOffset;
	UInt m_colorOffset;
};

} //namespace gd
} //namespace tt

#endif //_gd_VERTEXACCESSOR_H_